Improve logging when error occurs while changing folder permissions.
authorCamila Ayres <hello@camilasan.com>
Thu, 30 Jan 2025 17:59:56 +0000 (18:59 +0100)
committerMatthieu Gallien <matthieu.gallien@nextcloud.com>
Thu, 6 Feb 2025 17:02:20 +0000 (18:02 +0100)
Signed-off-by: Camila Ayres <hello@camilasan.com>
src/libsync/filesystem.cpp

index 2f288b85fe5bd37af7373560882da3c48008d77c..8361d8af550ee655a89b216e78231de5673496ef 100644 (file)
@@ -344,17 +344,17 @@ bool FileSystem::setFolderPermissions(const QString &path,
     }
     catch (const std::filesystem::filesystem_error &e)
     {
-        qCWarning(lcFileSystem()) << "exception when modifying folder permissions" << e.what() << e.path1().c_str() << e.path2().c_str();
+        qCWarning(lcFileSystem()) << "exception when modifying folder permissions" << e.what() << "- path1:" << e.path1().c_str() << "- path2:" << e.path2().c_str();
         return false;
     }
     catch (const std::system_error &e)
     {
-        qCWarning(lcFileSystem()) << "exception when modifying folder permissions" << e.what();
+        qCWarning(lcFileSystem()) << "exception when modifying folder permissions" << e.what() << "- path:" << stdStrPath;
         return false;
     }
     catch (...)
     {
-        qCWarning(lcFileSystem()) << "exception when modifying folder permissions";
+        qCWarning(lcFileSystem()) << "exception when modifying folder permissions -  path:" << stdStrPath;
         return false;
     }
 
@@ -494,12 +494,12 @@ bool FileSystem::setFolderPermissions(const QString &path,
     }
     catch (const std::system_error &e)
     {
-        qCWarning(lcFileSystem()) << "exception when modifying folder permissions" << e.what();
+        qCWarning(lcFileSystem()) << "exception when modifying folder permissions" << e.what() << "- path:" << stdStrPath;
         return false;
     }
     catch (...)
     {
-        qCWarning(lcFileSystem()) << "exception when modifying folder permissions";
+        qCWarning(lcFileSystem()) << "exception when modifying folder permissions -  path:" << stdStrPath;
         return false;
     }
 
@@ -516,17 +516,17 @@ bool FileSystem::isFolderReadOnly(const std::filesystem::path &path) noexcept
     }
     catch (const std::filesystem::filesystem_error &e)
     {
-        qCWarning(lcFileSystem()) << "exception when checking folder permissions" << e.what() << e.path1().c_str() << e.path2().c_str();
+        qCWarning(lcFileSystem()) << "exception when checking folder permissions" << e.what() << "- path1:" << e.path1().c_str() << "- path2:" << e.path2().c_str();
         return false;
     }
     catch (const std::system_error &e)
     {
-        qCWarning(lcFileSystem()) << "exception when checking folder permissions" << e.what();
+        qCWarning(lcFileSystem()) << "exception when checking folder permissions" << e.what() << "- path:" << path;
         return false;
     }
     catch (...)
     {
-        qCWarning(lcFileSystem()) << "exception when checking folder permissions";
+        qCWarning(lcFileSystem()) << "exception when checking folder permissions -  path:" << path;
         return false;
     }
 }
@@ -545,15 +545,15 @@ FileSystem::FilePermissionsRestore::FilePermissionsRestore(const QString &path,
     }
     catch (const std::filesystem::filesystem_error &e)
     {
-        qCWarning(lcFileSystem()) << "exception when modifying folder permissions" << e.what() << e.path1().c_str() << e.path2().c_str();
+        qCWarning(lcFileSystem()) << "exception when modifying folder permissions" << e.what() << "- path1:" << e.path1().c_str() << "- path2:" << e.path2().c_str();
     }
     catch (const std::system_error &e)
     {
-        qCWarning(lcFileSystem()) << "exception when modifying folder permissions" << e.what();
+        qCWarning(lcFileSystem()) << "exception when modifying folder permissions" << e.what() << "- path:" << path;
     }
     catch (...)
     {
-        qCWarning(lcFileSystem()) << "exception when modifying folder permissions";
+        qCWarning(lcFileSystem()) << "exception when modifying folder permissions -  path:" << path;
     }
 }